/*
 * ShubertFuction.cpp
 *
 *  Created on: 2010-01-13
 *      Author: adas
 */

#include <cmath>

#include "RastriginFunction.h"

double RastriginFunction::operator()(const Element & el)
{
	int n = el.getDimensionCount();

	double s = 0;

	for(int i = 0; i < n; ++i)
	{
		s += el.getValueAt(i)*el.getValueAt(i) - 10*cos(2*M_PI*el.getValueAt(i));
	}

	return 10*n + s;

}
